package org.dfzt.modules.online.cgform.converter;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.dfzt.common.util.oConvertUtils;
import org.dfzt.modules.online.cgform.entity.OnlCgformField;


public class b {
//  public static final int a = 2;
//  public static final int b = 1;

    public static void a(int paramInt, List<Map<String, Object>> paramList1, List<OnlCgformField> paramList2) {
        Map<String, FieldCommentConverter> map = a.a(paramList2);
        for (Map<String, Object> map1 : paramList1) {
            Iterator iterator = map1.entrySet().iterator();

            HashMap<String, Object> hashMap = new HashMap<>();
            while (iterator.hasNext()) {
                Map.Entry entry = (Map.Entry) iterator.next();
                Object object = entry.getValue();
                if (object == null) {
                    continue;
                }
                String str = (String) entry.getKey();
                FieldCommentConverter fieldCommentConverter = (FieldCommentConverter) map.get(str);
                if (fieldCommentConverter != null) {
                    String str1 = object.toString();
                    String str2 = (paramInt == 1) ? fieldCommentConverter.converterToTxt(str1) : fieldCommentConverter.converterToVal(str1);


                    a(fieldCommentConverter, map1, paramInt);
                    a(fieldCommentConverter, hashMap, str1);
                    map1.put(str, str2);
                }
            }
            for (String str : hashMap.keySet()) {
                map1.put(str, hashMap.get(str));
            }
        }
    }


    private static void a(FieldCommentConverter paramFieldCommentConverter, Map<String, Object> paramMap, int paramInt) {
        Map map = paramFieldCommentConverter.getConfig();
        if (map != null) {
            String str = (String) map.get("linkField");
            if (oConvertUtils.isNotEmpty(str)) {
                for (String str1 : str.split(",")) {
                    Object object = paramMap.get(str1);
                    if (object != null) {


                        String str2 = object.toString();
                        String str3 = (paramInt == 1) ? paramFieldCommentConverter.converterToTxt(str2) : paramFieldCommentConverter.converterToVal(str2);
                        paramMap.put(str1, str3);
                    }
                }
            }
        }
    }


    private static void a(FieldCommentConverter paramFieldCommentConverter, Map<String, Object> paramMap, String paramString) {
        Map map = paramFieldCommentConverter.getConfig();
        if (map != null) {

            String str = (String) map.get("treeText");
            if (oConvertUtils.isNotEmpty(str)) {
                paramMap.put(str, paramString);
            }
        }
    }
}
